﻿namespace Painter3D.PhysicalSys
{
    /// <summary>
    /// 简单完成数据的转换匹配，效率不好
    /// </summary>
    static class BulletClassExtension
    {
        public static OpenTK.Vector3 Convert2TK(this BulletSharp.Math.Vector3 vector)
        {
            return new OpenTK.Vector3(vector.X, vector.Y, vector.Z);
        }
        public static OpenTK.Vector4 Convert2TK(this BulletSharp.Math.Vector4 vector)
        {
            return new OpenTK.Vector4(vector.X, vector.Y, vector.Z, vector.W);
        }
        public static OpenTK.Quaternion Convert2TK(this BulletSharp.Math.Quaternion qua)
        {
            return new OpenTK.Quaternion(qua.X, qua.Y, qua.Z, qua.W);
        }
        public static OpenTK.Matrix4 Convert2TK(this BulletSharp.Math.Matrix matrix)
        {
            return new OpenTK.Matrix4() {
                M11 = matrix.M11,M12 = matrix.M12,M13 = matrix.M13,M14 = matrix.M14,
                M21 = matrix.M21,M22 = matrix.M22,M23 = matrix.M23,M24 = matrix.M24,
                M31 = matrix.M31,M32 = matrix.M32,M33 = matrix.M33,M34 = matrix.M34,
                M41 = matrix.M41,M42 = matrix.M42,M43 = matrix.M43,M44 = matrix.M44,
            };
        }
        public static BulletSharp.Math.Vector3 Convert2BT(this OpenTK.Vector3 vector)
        {
            return new BulletSharp.Math.Vector3(vector.X, vector.Y, vector.Z);
        }
        public static BulletSharp.Math.Vector4 Convert2BT(this OpenTK.Vector4 vector)
        {
            return new BulletSharp.Math.Vector4(vector.X, vector.Y, vector.Z,vector.W);
        }
        public static BulletSharp.Math.Quaternion Convert2BT(this OpenTK.Quaternion qua)
        {
            return new BulletSharp.Math.Quaternion(qua.X, qua.Y, qua.Z, qua.W);
        }
        public static BulletSharp.Math.Matrix Convert2BT(this OpenTK.Matrix4 matrix)
        {
            return new BulletSharp.Math.Matrix() { 
                M11 = matrix.M11,M12 = matrix.M12,M13 = matrix.M13,M14 = matrix.M14,
                M21 = matrix.M21,M22 = matrix.M22,M23 = matrix.M23,M24 = matrix.M24,
                M31 = matrix.M31,M32 = matrix.M32,M33 = matrix.M33,M34 = matrix.M34,
                M41 = matrix.M41,M42 = matrix.M42,M43 = matrix.M43,M44 = matrix.M44,
            };
        }

        
    }
}
